import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpCourseProgress {
  id!: number;
  userId?: number;
  sid?: number;
  isComplete: boolean = false;
  addTime?: string;
  updateTime?: string;
  completeTime?: string;
  endSecond?: number;
  maxSecond?: number;
  uniacid!: number;
}

export const ImsYzdKpCourseProgressSchema = new EntitySchema({
  class: ImsYzdKpCourseProgress,
  properties: {
    id: { primary: true, type: 'number' },
    userId: { type: 'number', nullable: true, index: 'user_id' },
    sid: { type: 'number', nullable: true, index: 'sid' },
    isComplete: { type: 'boolean', default: false, index: 'is_complete' },
    addTime: { type: 'string', length: 255, nullable: true },
    updateTime: { type: 'string', length: 255, nullable: true },
    completeTime: { type: 'string', length: 255, nullable: true },
    endSecond: { type: 'number', nullable: true, index: 'end_second' },
    maxSecond: { type: 'number', nullable: true, index: 'max_second' },
    uniacid: { type: 'number', index: 'uniacid' },
  },
});
